﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tools
{
    public class CircularQueue<T>
    {
        Queue<T> _Queue;

        public CircularQueue(uint size)           {_Queue = new Queue<T>((int)size);}
        public CircularQueue(IEnumerable<T> list) {_Queue = new Queue<T>(list);}

        public T Rotate()
        {
            T t = _Queue.Dequeue();
            _Queue.Enqueue(t);
            return t;
        }

        public IEnumerable<T> Members        {get {return _Queue.AsEnumerable();}   protected set {;}}
        public IEnumerable<T> NonHeadMembers {get {return Members.Skip(1);}         protected set {;}}
        
        public T    Head  {get {return _Queue.Peek();}          protected set {;}}
        public uint Count {get {return (uint)_Queue.Count();}   protected set {;}}
    }
}
